package com.gxa.controller;

import com.gxa.common.Constants;
import com.gxa.common.JsonResult;
import com.gxa.common.PageRecv;
import com.gxa.common.R;
import com.gxa.pojo.Employee;
import com.gxa.service.AddressBookService;
import io.swagger.annotations.Api;


import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@Api(value = "内部通讯录查询text",tags = "内部通讯录查询接口API")
@RequestMapping(value = "/Emp")
public class AddressBookController {
    @Autowired
    private AddressBookService addressBookService;


    @RequestMapping(value = "/selectEmployee",method = RequestMethod.POST)
    @ResponseBody
    public JsonResult selectEmployee(@RequestBody PageRecv pageRecv){
        return addressBookService.selectEmp(pageRecv.getCurrentPage(),pageRecv.getPageSize());
    }




    /**
     * 搜索以及根据部门查询
     * @param pageRecv
     * @return
     */
    @RequestMapping(value = "/searchEmployee",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "搜索员工信息",notes = "根据详细搜索员工信息",httpMethod = "post",response = R.class)
    public JsonResult searchDept(@RequestBody PageRecv<Employee> pageRecv){
        System.out.println(pageRecv);
        return addressBookService.searchEmployee(pageRecv);
    }
}
